package com.oet.persistence.entity;

// Generated Jan 25, 2010 9:49:58 AM by Hibernate Tools 3.2.4.GA


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Lob;
import javax.persistence.TableGenerator;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.springframework.beans.support.MutableSortDefinition;
import org.springframework.beans.support.PropertyComparator;
import org.springframework.core.style.ToStringCreator;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;



/**
 * Owners generated by hbm2java
 */
@Entity
@Table(name = "files", catalog = "oet")
public class UploadedFile implements java.io.Serializable {

	private Long id;
	private String fileName;
	private String fileType;
	private Long fileSize;
	private String discription;
	
	private byte[] fileContent;
	

	public UploadedFile() {
	}

	public UploadedFile(String fileName, String fileType, Long fileSize, String discription,
			byte[] fileContent) {
		this.fileName = fileName;
		this.fileType = fileType;
		this.fileSize = fileSize;
		this.discription = discription;
		this.fileContent = fileContent;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)	
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "file_name", nullable = false)
	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	
	@Column(name = "file_type", nullable = false)
	public String getFileType() {
		return fileType;
	}

	public void setFileType(String fileType) {
		this.fileType = fileType;
	}
	
	@Column(name = "file_size", nullable = false)
	public Long getFileSize() {
		return fileSize;
	}

	public void setFileSize(Long fileSize) {
		this.fileSize = fileSize;
	}
	
	@Column(name = "discription")
	public String getDiscription() {
		return discription;
	}

	public void setDiscription(String discription) {
		this.discription = discription;
	}

	@Lob
	@Column(name = "fileContent")
	public byte[] getFileContent() {
		return fileContent;
	}

	public void setFileContent(byte[] fileContent) {
		this.fileContent = fileContent;
	}
	
	/*
	 * Add more helper methods here...
	 */
	@Transient
	public boolean isNew() {
		return (this.id == null);
	}
	/**
	 * For more strict JPA
	 */
	@Transient
	public void setNew(boolean isNew) {
		;
	}
	@Transient
	public boolean getNew() {
		return (this.id == null);
	}
	


}
